import 'dart:math';

import 'package:flutter/material.dart';

//主题色
Color kAppThemeColor = kAppColor('#165DFF');
Color kAppLeftColor = kAppColor('#7CFCB8');
Color kAppRightColor = kAppColor('#D8FD73');
Color kAppMainColor = const Color(0xFF6D4EFA);
//背景色
Color kAppBcgColor = const Color(0xFFF8F8F8);
//一级文字
Color kAppTextColor = kAppColor('#333333');
//二级文字
Color kAppSubTextColor = kAppColor('#666666');
//三级文字
Color kAppSub2TextColor = kAppColor('#999999');
//四级文字
Color kAppSub3TextColor = kAppColor('#DBDDDC');
//阴影
Color kShadowColor = const Color(0xeef8f8f8);
//白色
Color kAppWhiteColor = const Color(0xFFFFFFFF);

///黑色
Color kAppBlackColor = const Color(0xFF333333);
//下划线
Color kAppLineColor = const Color(0xFFEDEEF1);

Color kAppColor(String hex) {
  try {
    String colorStr = hex.replaceAll("#", "");
    String prefix = (8 == hex.length) ? "0x" : "0xFF";
    return Color(int.parse(prefix + colorStr));
  } catch (e) {
    return Colors.white;
  }
}

Divider kAppDivider = Divider(height: 1.0, color: kAppColor("#D8D8D8"));

Color randomColor() {
  var random = Random();
  int r = random.nextInt(255);
  int g = random.nextInt(255);
  int b = random.nextInt(255);
  return Color.fromARGB(255, r, g, b);
}
